.class public Lrexsee/barcode/DecodeHandler;
.super Landroid/os/Handler;
.source "DecodeHandler.java"


# static fields
.field public static final MESSAGE_AUTO_FOCUS:I = 0x0

.field public static final MESSAGE_DECODE:I = 0x4

.field public static final MESSAGE_DECODE_FAILED:I = 0x3

.field public static final MESSAGE_DECODE_SUCCEEDED:I = 0x2

.field public static final MESSAGE_QUIT:I = 0x5

.field public static final MESSAGE_RESTART_PREVIEW:I = 0x1


# instance fields
.field private final mDialog:Lrexsee/barcode/BarcodeCaptureDialog;

.field private final multiFormatReader:Lcom/google/zxing/MultiFormatReader;


# direct methods
.method public constructor <init>(Lrexsee/barcode/BarcodeCaptureDialog;Ljava/util/Hashtable;)V
    .locals 1
    .param p1, "dialog"    # Lrexsee/barcode/BarcodeCaptureDialog;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Lrexsee/barcode/BarcodeCaptureDialog;",
            "Ljava/util/Hashtable",
            "<",
            "Lcom/google/zxing/DecodeHintType;",
            "Ljava/lang/Object;",
            ">;)V"
        }
    .end annotation

    .prologue
    .line 30
    .local p2, "hints":Ljava/util/Hashtable;, "Ljava/util/Hashtable<Lcom/google/zxing/DecodeHintType;Ljava/lang/Object;>;"
    invoke-direct {p0}, Landroid/os/Handler;-><init>()V

    .line 31
    new-instance v0, Lcom/google/zxing/MultiFormatReader;

    invoke-direct {v0}, Lcom/google/zxing/MultiFormatReader;-><init>()V

    iput-object v0, p0, Lrexsee/barcode/DecodeHandler;->multiFormatReader:Lcom/google/zxing/MultiFormatReader;

    .line 32
    iget-object v0, p0, Lrexsee/barcode/DecodeHandler;->multiFormatReader:Lcom/google/zxing/MultiFormatReader;

    invoke-virtual {v0, p2}, Lcom/google/zxing/MultiFormatReader;->setHints(Ljava/util/Hashtable;)V

    .line 33
    iput-object p1, p0, Lrexsee/barcode/DecodeHandler;->mDialog:Lrexsee/barcode/BarcodeCaptureDialog;

    .line 34
    return-void
.end method


# virtual methods
.method public handleMessage(Landroid/os/Message;)V
    .locals 16
    .param p1, "message"    # Landroid/os/Message;

    .prologue
    .line 38
    move-object/from16 v0, p1

    iget v0, v0, Landroid/os/Message;->what:I

    move v5, v0

    const/4 v6, 0x4

    if-ne v5, v6, :cond_4

    .line 39
    const/4 v15, 0x0

    .line 40
    .local v15, "rawResult":Lcom/google/zxing/Result;
    const/4 v1, 0x0

    .line 41
    .local v1, "source":Lrexsee/barcode/PlanarYUVLuminanceSource;
    move-object/from16 v0, p1

    iget-object v0, v0, Landroid/os/Message;->obj:Ljava/lang/Object;

    move-object v2, v0

    check-cast v2, [B

    .line 42
    .local v2, "data":[B
    move-object/from16 v0, p1

    iget v0, v0, Landroid/os/Message;->arg1:I

    move v3, v0

    .local v3, "width":I
    move-object/from16 v0, p1

    iget v0, v0, Landroid/os/Message;->arg2:I

    move v4, v0

    .line 43
    .local v4, "height":I
    move-object/from16 v0, p0

    iget-object v0, v0, Lrexsee/barcode/DecodeHandler;->mDialog:Lrexsee/barcode/BarcodeCaptureDialog;

    move-object v5, v0

    iget v5, v5, Lrexsee/barcode/BarcodeCaptureDialog;->mPreviewFormat:I

    packed-switch v5, :pswitch_data_0

    .line 51
    :goto_0
    const-string v5, "yuv420p"

    move-object/from16 v0, p0

    iget-object v0, v0, Lrexsee/barcode/DecodeHandler;->mDialog:Lrexsee/barcode/BarcodeCaptureDialog;

    move-object v6, v0

    iget-object v6, v6, Lrexsee/barcode/BarcodeCaptureDialog;->mPreviewFormatString:Ljava/lang/String;

    invoke-virtual {v5, v6}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v5

    if-eqz v5, :cond_0

    .line 52
    new-instance v1, Lrexsee/barcode/PlanarYUVLuminanceSource;

    .end local v1    # "source":Lrexsee/barcode/PlanarYUVLuminanceSource;
    move-object/from16 v0, p0

    iget-object v0, v0, Lrexsee/barcode/DecodeHandler;->mDialog:Lrexsee/barcode/BarcodeCaptureDialog;

    move-object v5, v0

    iget-object v5, v5, Lrexsee/barcode/BarcodeCaptureDialog;->mFramingRectInPreview:Landroid/graphics/Rect;

    iget v5, v5, Landroid/graphics/Rect;->left:I

    move-object/from16 v0, p0

    iget-object v0, v0, Lrexsee/barcode/DecodeHandler;->mDialog:Lrexsee/barcode/BarcodeCaptureDialog;

    move-object v6, v0

    iget-object v6, v6, Lrexsee/barcode/BarcodeCaptureDialog;->mFramingRectInPreview:Landroid/graphics/Rect;

    iget v6, v6, Landroid/graphics/Rect;->top:I

    move-object/from16 v0, p0

    iget-object v0, v0, Lrexsee/barcode/DecodeHandler;->mDialog:Lrexsee/barcode/BarcodeCaptureDialog;

    move-object v7, v0

    iget-object v7, v7, Lrexsee/barcode/BarcodeCaptureDialog;->mFramingRectInPreview:Landroid/graphics/Rect;

    invoke-virtual {v7}, Landroid/graphics/Rect;->width()I

    move-result v7

    move-object/from16 v0, p0

    iget-object v0, v0, Lrexsee/barcode/DecodeHandler;->mDialog:Lrexsee/barcode/BarcodeCaptureDialog;

    move-object v8, v0

    iget-object v8, v8, Lrexsee/barcode/BarcodeCaptureDialog;->mFramingRectInPreview:Landroid/graphics/Rect;

    invoke-virtual {v8}, Landroid/graphics/Rect;->height()I

    move-result v8

    invoke-direct/range {v1 .. v8}, Lrexsee/barcode/PlanarYUVLuminanceSource;-><init>([BIIIIII)V

    .line 55
    .restart local v1    # "source":Lrexsee/barcode/PlanarYUVLuminanceSource;
    :cond_0
    if-nez v1, :cond_2

    .line 56
    move-object/from16 v0, p0

    iget-object v0, v0, Lrexsee/barcode/DecodeHandler;->mDialog:Lrexsee/barcode/BarcodeCaptureDialog;

    move-object v5, v0

    invoke-virtual {v5}, Lrexsee/barcode/BarcodeCaptureDialog;->getContext()Landroid/content/Context;

    move-result-object v5

    new-instance v6, Ljava/lang/StringBuilder;

    const-string v7, "Unsupported picture format: "

    invoke-direct {v6, v7}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    move-object/from16 v0, p0

    iget-object v0, v0, Lrexsee/barcode/DecodeHandler;->mDialog:Lrexsee/barcode/BarcodeCaptureDialog;

    move-object v7, v0

    iget v7, v7, Lrexsee/barcode/BarcodeCaptureDialog;->mPreviewFormat:I

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v6

    const/16 v7, 0x2f

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;

    move-result-object v6

    move-object/from16 v0, p0

    iget-object v0, v0, Lrexsee/barcode/DecodeHandler;->mDialog:Lrexsee/barcode/BarcodeCaptureDialog;

    move-object v7, v0

    iget-object v7, v7, Lrexsee/barcode/BarcodeCaptureDialog;->mPreviewFormatString:Ljava/lang/String;

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v6

    const/4 v7, 0x1

    invoke-static {v5, v6, v7}, Landroid/widget/Toast;->makeText(Landroid/content/Context;Ljava/lang/CharSequence;I)Landroid/widget/Toast;

    move-result-object v5

    invoke-virtual {v5}, Landroid/widget/Toast;->show()V

    .line 57
    move-object/from16 v0, p0

    iget-object v0, v0, Lrexsee/barcode/DecodeHandler;->mDialog:Lrexsee/barcode/BarcodeCaptureDialog;

    move-object v5, v0

    const/4 v6, 0x0

    const/4 v7, 0x0

    const/4 v8, 0x0

    const/4 v9, 0x0

    const/4 v10, 0x0

    const/4 v11, 0x0

    invoke-virtual/range {v5 .. v11}, Lrexsee/barcode/BarcodeCaptureDialog;->dismissDialog(Landroid/graphics/Bitmap;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

    .line 80
    .end local v1    # "source":Lrexsee/barcode/PlanarYUVLuminanceSource;
    .end local v2    # "data":[B
    .end local v3    # "width":I
    .end local v4    # "height":I
    .end local v15    # "rawResult":Lcom/google/zxing/Result;
    :cond_1
    :goto_1
    return-void

    .line 48
    .restart local v1    # "source":Lrexsee/barcode/PlanarYUVLuminanceSource;
    .restart local v2    # "data":[B
    .restart local v3    # "width":I
    .restart local v4    # "height":I
    .restart local v15    # "rawResult":Lcom/google/zxing/Result;
    :pswitch_0
    new-instance v1, Lrexsee/barcode/PlanarYUVLuminanceSource;

    .end local v1    # "source":Lrexsee/barcode/PlanarYUVLuminanceSource;
    move-object/from16 v0, p0

    iget-object v0, v0, Lrexsee/barcode/DecodeHandler;->mDialog:Lrexsee/barcode/BarcodeCaptureDialog;

    move-object v5, v0

    iget-object v5, v5, Lrexsee/barcode/BarcodeCaptureDialog;->mFramingRectInPreview:Landroid/graphics/Rect;

    iget v5, v5, Landroid/graphics/Rect;->left:I

    move-object/from16 v0, p0

    iget-object v0, v0, Lrexsee/barcode/DecodeHandler;->mDialog:Lrexsee/barcode/BarcodeCaptureDialog;

    move-object v6, v0

    iget-object v6, v6, Lrexsee/barcode/BarcodeCaptureDialog;->mFramingRectInPreview:Landroid/graphics/Rect;

    iget v6, v6, Landroid/graphics/Rect;->top:I

    move-object/from16 v0, p0

    iget-object v0, v0, Lrexsee/barcode/DecodeHandler;->mDialog:Lrexsee/barcode/BarcodeCaptureDialog;

    move-object v7, v0

    iget-object v7, v7, Lrexsee/barcode/BarcodeCaptureDialog;->mFramingRectInPreview:Landroid/graphics/Rect;

    invoke-virtual {v7}, Landroid/graphics/Rect;->width()I

    move-result v7

    move-object/from16 v0, p0

    iget-object v0, v0, Lrexsee/barcode/DecodeHandler;->mDialog:Lrexsee/barcode/BarcodeCaptureDialog;

    move-object v8, v0

    iget-object v8, v8, Lrexsee/barcode/BarcodeCaptureDialog;->mFramingRectInPreview:Landroid/graphics/Rect;

    invoke-virtual {v8}, Landroid/graphics/Rect;->height()I

    move-result v8

    invoke-direct/range {v1 .. v8}, Lrexsee/barcode/PlanarYUVLuminanceSource;-><init>([BIIIIII)V

    .restart local v1    # "source":Lrexsee/barcode/PlanarYUVLuminanceSource;
    goto/16 :goto_0

    .line 60
    :cond_2
    new-instance v12, Lcom/google/zxing/BinaryBitmap;

    new-instance v5, Lcom/google/zxing/common/HybridBinarizer;

    invoke-direct {v5, v1}, Lcom/google/zxing/common/HybridBinarizer;-><init>(Lcom/google/zxing/LuminanceSource;)V

    invoke-direct {v12, v5}, Lcom/google/zxing/BinaryBitmap;-><init>(Lcom/google/zxing/Binarizer;)V

    .line 62
    .local v12, "bitmap":Lcom/google/zxing/BinaryBitmap;
    :try_start_0
    move-object/from16 v0, p0

    iget-object v0, v0, Lrexsee/barcode/DecodeHandler;->multiFormatReader:Lcom/google/zxing/MultiFormatReader;

    move-object v5, v0

    invoke-virtual {v5, v12}, Lcom/google/zxing/MultiFormatReader;->decodeWithState(Lcom/google/zxing/BinaryBitmap;)Lcom/google/zxing/Result;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    move-result-object v15

    .line 65
    move-object/from16 v0, p0

    iget-object v0, v0, Lrexsee/barcode/DecodeHandler;->multiFormatReader:Lcom/google/zxing/MultiFormatReader;

    move-object v5, v0

    invoke-virtual {v5}, Lcom/google/zxing/MultiFormatReader;->reset()V

    .line 67
    :goto_2
    if-eqz v15, :cond_3

    .line 68
    move-object/from16 v0, p0

    iget-object v0, v0, Lrexsee/barcode/DecodeHandler;->mDialog:Lrexsee/barcode/BarcodeCaptureDialog;

    move-object v5, v0

    iget-object v5, v5, Lrexsee/barcode/BarcodeCaptureDialog;->mCaptureHandler:Lrexsee/barcode/CaptureHandler;

    const/4 v6, 0x2

    invoke-static {v5, v6, v15}, Landroid/os/Message;->obtain(Landroid/os/Handler;ILjava/lang/Object;)Landroid/os/Message;

    move-result-object v14

    .line 69
    .local v14, "msg":Landroid/os/Message;
    new-instance v13, Landroid/os/Bundle;

    invoke-direct {v13}, Landroid/os/Bundle;-><init>()V

    .line 70
    .local v13, "bundle":Landroid/os/Bundle;
    const-string v5, "barcode_bitmap"

    invoke-virtual {v1}, Lrexsee/barcode/PlanarYUVLuminanceSource;->renderCroppedGreyscaleBitmap()Landroid/graphics/Bitmap;

    move-result-object v6

    invoke-virtual {v13, v5, v6}, Landroid/os/Bundle;->putParcelable(Ljava/lang/String;Landroid/os/Parcelable;)V

    .line 71
    invoke-virtual {v14, v13}, Landroid/os/Message;->setData(Landroid/os/Bundle;)V

    .line 72
    invoke-virtual {v14}, Landroid/os/Message;->sendToTarget()V

    goto :goto_1

    .line 63
    .end local v13    # "bundle":Landroid/os/Bundle;
    .end local v14    # "msg":Landroid/os/Message;
    :catch_0
    move-exception v5

    .line 65
    move-object/from16 v0, p0

    iget-object v0, v0, Lrexsee/barcode/DecodeHandler;->multiFormatReader:Lcom/google/zxing/MultiFormatReader;

    move-object v5, v0

    invoke-virtual {v5}, Lcom/google/zxing/MultiFormatReader;->reset()V

    goto :goto_2

    .line 64
    :catchall_0
    move-exception v5

    .line 65
    move-object/from16 v0, p0

    iget-object v0, v0, Lrexsee/barcode/DecodeHandler;->multiFormatReader:Lcom/google/zxing/MultiFormatReader;

    move-object v6, v0

    invoke-virtual {v6}, Lcom/google/zxing/MultiFormatReader;->reset()V

    .line 66
    throw v5

    .line 74
    :cond_3
    move-object/from16 v0, p0

    iget-object v0, v0, Lrexsee/barcode/DecodeHandler;->mDialog:Lrexsee/barcode/BarcodeCaptureDialog;

    move-object v5, v0

    iget-object v5, v5, Lrexsee/barcode/BarcodeCaptureDialog;->mCaptureHandler:Lrexsee/barcode/CaptureHandler;

    const/4 v6, 0x3

    invoke-static {v5, v6}, Landroid/os/Message;->obtain(Landroid/os/Handler;I)Landroid/os/Message;

    move-result-object v14

    .line 75
    .restart local v14    # "msg":Landroid/os/Message;
    invoke-virtual {v14}, Landroid/os/Message;->sendToTarget()V

    goto/16 :goto_1

    .line 77
    .end local v1    # "source":Lrexsee/barcode/PlanarYUVLuminanceSource;
    .end local v2    # "data":[B
    .end local v3    # "width":I
    .end local v4    # "height":I
    .end local v12    # "bitmap":Lcom/google/zxing/BinaryBitmap;
    .end local v14    # "msg":Landroid/os/Message;
    .end local v15    # "rawResult":Lcom/google/zxing/Result;
    :cond_4
    move-object/from16 v0, p1

    iget v0, v0, Landroid/os/Message;->what:I

    move v5, v0

    const/4 v6, 0x5

    if-ne v5, v6, :cond_1

    .line 78
    invoke-static {}, Landroid/os/Looper;->myLooper()Landroid/os/Looper;

    move-result-object v5

    invoke-virtual {v5}, Landroid/os/Looper;->quit()V

    goto/16 :goto_1

    .line 43
    nop

    :pswitch_data_0
    .packed-switch 0x10
        :pswitch_0
        :pswitch_0
    .end packed-switch
.end method
